//
//  VendorMacro.h
//  TicketingSystem
//
//  Created by Conner Wu on 15/7/21.
//  Copyright (c) 2015年 Beyondsoft. All rights reserved.
//

#ifndef VendorMacro_h
#define VendorMacro_h

static inline BOOL isMobileNumber(NSString *mobileNum) {
    
//    NSString *MOBILE = @"^1(3[0-9]|4[57]|5[0-35-9]|8[0-9]|7[06-8])\\d{8}$";
//    NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE];

    return YES;
}

static inline BOOL comparisonString(NSString *leftString, NSString *rightString) {
    return [leftString isEqualToString:rightString];
}

/*
 每发新版本都dbVersion 都修改下，使得用户删除原来沙盒的数据库文件 重新加载
 */
#define kPublicDBVersion    0.9
#define kUserDBVersion      0.9 

#define kVersion    [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]


//取得应用版本编号
#define kHarpyCurrentVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey]

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define RGB(Red,Green,Blue) [UIColor colorWithRed:Red/255.0 green:Green/255.0 blue:Blue/255.0 alpha:1.0]

#define COLOR(R, G, B, A)   [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]


#define SCREEN_WIDTH        [[UIScreen mainScreen] bounds].size.width

#define SCREEN_HEIGHT       [[UIScreen mainScreen] bounds].size.height

#define kScreenWidth        CGRectGetWidth([UIScreen mainScreen].bounds)

#define kScreenHeight       CGRectGetHeight([UIScreen mainScreen].bounds)

#define kImg(img)  [UIImage imageNamed:img]

#define SharedApp   ((AppDelegate*)[[UIApplication sharedApplication] delegate])

#define iOS8Less    ([[[UIDevice currentDevice]systemVersion] floatValue] <  8.0)
#define iOS7Later   ([[[UIDevice currentDevice]systemVersion] floatValue] >= 7.0)
#define iOS8Later   ([[[UIDevice currentDevice]systemVersion] floatValue] >= 8.0)
#define iOS9Later   ([[[UIDevice currentDevice]systemVersion] floatValue] >= 9.0)

#define kR3_5       ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define kR4_0       ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define kR4_7       ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

#define kR5_5       ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

/**目录宏**/
#define kDocumentPath    [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]

#ifdef DEBUG
# define NSLog(format, ...) NSLog((/*@"[文件名:%s]"*/ @"[函数名:%s]" "[行号:%d]" format), /*__FILE__,*/ __FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...);
#endif

#define iPhone4S    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone5S    ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6     ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6Plus [[UIScreen mainScreen] bounds].size.width == 414.f && [[UIScreen mainScreen] bounds].size.height == 736.f

#define kNavBarCommonBgColor    UIColorFromRGB(0xf5f5f5)

#define kCommonKeyColor         RGB(67,92,154)

#define kCommonBlackTextColor   RGB(33,33,33)

//用户类型：1=经销商，2=区域主管，3=区域经理，4=省区经理
#define kPersonTypeProvenceManner  4

#define kPersonTypeAreaManner  3

#define kPersonTypeAreaCharge  2

#define kPersonTypeAgency  1


#if !DEBUG

#define  kPaySwitchIsOpen         1//1表示需要支付，此处表示生产环境，不要改动

#else

#define  kPaySwitchIsOpen         1//测试环境

#endif


#define kPageSize @"10"


#define kNotFirstUseApp            @"NotFirstUseApp"//存放 是否第一次打开app 的标志

#define kPlacehodelImg          @""  //占位图


#endif
